/**
 * @description: 个人中心
 */

const express = require("express");
const userHandler = require("../router_handler/userinfo");
// 导入验证表单数据的中间件
const expressJoi = require("@escook/express-joi");
const { update_userinfo_schema, updatePassword_schema } = require("../schema/user");

const router = express.Router();

// 获取用户信息
router.get("/getUserInfo", userHandler.getUserInfo);

// 修改用户信息
router.post(
  "/updateUserInfo",
  expressJoi(update_userinfo_schema),
  userHandler.updateUserInfo
);

router.post('/updatePassword', userHandler.updatePassword);

// 更换头像
router.post('/updateAvatar', expressJoi(updatePassword_schema), userHandler.updateAvatar);

module.exports = router;
